package com.qf.controller;

import com.qf.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import javax.servlet.http.HttpServletRequest;
import java.util.Arrays;

/**
 * @version v1.0.0
 * @Description:
 * @author: 赵英杰
 * @date: 2022.02.11
 * @since 1.0
 */
@Controller
@RequestMapping("/hello")
public class HelloController {
    @RequestMapping("/test1")  //访问路径
    public String hello1() {
        System.out.println("hello world");
        return "forward:/index.jsp";  // 跳转:/index.jsp
    }

    @RequestMapping("/test2") //访问路径
    public String hello2() {
        System.out.println("hello c9");
/*
        return "/WEB-INF/jsp/hello.jsp"; //  跳转:/jsp/hello2.jsp
*/
        return "hello"; //  跳转:/jsp/hello2.jsp
    }

    @RequestMapping("/test03")
    public String test03(HttpServletRequest request) {
        String id = request.getParameter("id");
        String name = request.getParameter("name");
        System.out.println("id:" + id);
        System.out.println("name:" + name);
        return "hello";
    }

    @RequestMapping("/test04")
    public String test04(Integer id, String name) {
        System.out.println("id:" + id);
        System.out.println("name:" + name);
        return "hello";
    }
    @RequestMapping("/test05")
    public String test05(User user) {
        System.out.println(user);
        return "hello";
    }

    @RequestMapping("test06")
    public String test06(String[] hobby){
        System.out.println(Arrays.toString(hobby));
        return "hello";
    }
}
